#include <cstddef>
#include <iostream>
#include <cstring>
#include <iterator>
#include <string>
using namespace std;
class Cow {
	char name[20];
	char * hobby;
	double weight;
	public:
		Cow();
		Cow(const char * nm, const char * ho, double wt);
		Cow(const Cow &c);
		~Cow();
		Cow & operator=(const Cow & c);
		void ShowCow() const; // display all cow data
};
Cow::Cow()
{
	this->name[0]=0;
	this->hobby=new char[1];
	this->weight=0;
}
Cow::Cow(const char *nm,const char *ho,double wt)
{
	strcpy(this->name,nm);
	this->hobby=new char[strlen(ho)+1];
	strcpy(this->hobby,ho);
	this->weight=wt;
}
Cow::Cow(const Cow &c)
{
	strcpy(this->name,c.name);
	this->hobby=new char[strlen(c.hobby)+1];
	strcpy(this->hobby,c.hobby);
	this->weight=c.weight;
}
Cow& Cow::operator=(const Cow &c)
{
	if(this==&c){
		return *this;
	}
	strcpy(this->name,c.name);
	delete []this->hobby;
	this->hobby=new char[strlen(c.hobby)+1];
	strcpy(this->hobby,c.hobby);
	return *this;
}
Cow::~Cow()
{
	if(this->hobby!=NULL){
		delete [] this->hobby;
		this->hobby=NULL;
	}
}
void Cow::ShowCow()const
{
	cout<<this->name<<' '
		<<this->hobby<<' '
		<<this->weight
		<<endl;
}
int main()
{
	char name[20];
	cin.getline(name,20);
	double we;
	string ho;
	getline(cin,ho);
	char *hooby=new char[ho.length()+1];
	strcpy(hooby,ho.c_str());
	hooby[ho.length()]=0;
	cin>>we;
	Cow c1(name,hooby,we);
	char name2[20];
	cin.clear();
	cin.ignore(1024,'\n');
	cin.getline(name2,20);
	delete [] hooby;
	string ho2;
	getline(cin,ho2);
	hooby=NULL;
	hooby=new char[ho2.length()+1];
	strcpy(hooby,ho2.c_str());
	hooby[ho2.length()]=0;
	cin>>we;
	Cow c2(name2,hooby,we);
	delete [] hooby;
	hooby=NULL;
	Cow c3=c1;
	Cow c4=c2;
	c3.ShowCow();
	c4.ShowCow();
	return 0;
}
